<template>
	<view>
		<u-navbar title="提现记录" :autoBack="true" :placeholder="true" leftIconColor="#ffffff" :titleStyle="{color: '#ffffff'}" bgColor="#1D1D20">
		</u-navbar>
		<view class="padding border-bottom bg-white margin radius-8" v-for="(item, index) in walletList" :key="index">
			<view class="flex justify-between font-32 text-bold">
				<view>{{ item.stateName }}</view>
				<view class="color-r">-{{item.amount}}</view>
			</view>
			<view class="text-black3 margin-tb-sm font-28" v-if="item.state == 2">
				拒绝原因:{{ item.rejectRemark }}
			</view>
			<view class="flex justify-between font-28 m-t-10">
				<view class="text-gray">{{item.createTime}}</view>
				<!-- <view class="text-gray" style="flex: none;">余额：{{item.afterAmount}}</view> -->
			</view>
		</view>
		<empty :show="walletList.length == 0" />
		<u-loadmore :status="status" color="#cccccc" class="padding-bottom" />
	</view>
</template>

<script>
	import { withDrawalHistory } from '@/common/api/xyc.js'
	export default {
		data() {
			return {
				pageNo: 0,
				walletList: [],
				status: 'loading',
				walletType: 15,
			};
		},
		onLoad() {
			this.getwalletFlow()
		},
		onReachBottom() {
			this.getwalletFlow()
		},
		methods: {
			getwalletFlow() {
				this.pageNo++
				this.status = 'loading'
				let params = {
					pageNo: this.pageNo,
					pageSize: 10
				}
				withDrawalHistory(params,this.walletType).then(res => {
					if(res.code === 200){
						res.data.forEach(item => {
							if(item.state == 0){
								item.stateName = '待审核'
							}
							if(item.state == 1){
								item.stateName = '提现成功'
							}
							if(item.state == 2){
								item.stateName = '提现失败'
							}
						})
						if(this.pageNo == 1){
							this.walletList = res.data
						}else{
							this.walletList = this.walletList.concat(res.data)
						}
					}
					if (res.data.length < 10) {
						this.status = 'nomore'
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page {
	background: #F2F3F5;
}
</style>
